<?php

//failsafe
if ($this->config->item('migrate_status') == 0) {
    header("Refresh:0");
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>YesilCMS Installation (2/2)</title>
    <script src="<?= base_url('assets/core/js/jquery.min.js'); ?>"></script>
    <script src="<?= base_url('assets/core/fontawesome/js/solid.min.js'); ?>" defer></script>
    <script src="<?= base_url('assets/core/fontawesome/js/fontawesome.min.js'); ?>" defer></script>
    <link rel="stylesheet" href="<?= base_url('assets/core/uikit/css/uikit.min.css'); ?>"/>
    <script src="<?= base_url('assets/core/uikit/js/uikit.min.js'); ?>"></script>
    <script src="<?= base_url('assets/core/uikit/js/uikit-icons.min.js'); ?>"></script>
    <link rel="stylesheet" href="<?= base_url('assets/core/amaranjs/css/amaran.min.css'); ?>"/>
    <script src="<?= base_url('assets/core/amaranjs/js/jquery.amaran.min.js'); ?>"></script>
</head>
<style>
  html, p, a, .uk-alert, .uk-logo {
    background: transparent;
    color: #f3f3f3;
  }

  .uk-icon-button {
    color: #000;
  }

  body {
    background-color: #211510;
    background-image: url();
    background-position: top;
    background-size: 150%;
    background-repeat: repeat;
  }

  h1, h2, .uk-h1, .uk-h5, .uk-logo:hover {
    color: #f8b700 !important;
  }

  .uk-alert-danger {
    background: #f0506e !important;
  }

  .uk-alert-warning {
    background: #c18f02 !important;
  }
</style>
<body>
<header>
    <div class="uk-navbar-container uk-navbar-transparent">
        <div class="uk-container">
            <nav class="uk-navbar" uk-navbar>
                <div class="uk-navbar-left">
                    <img width="48px"
                         src=''/>
                </div>
                <div class="uk-navbar-right">
                    <div class="uk-navbar-item">
                        <a target="_blank" href="https://github.com/yesilmen-vm/YesilCMS" class="uk-icon-button github uk-margin-small-right" uk-icon="icon: github; ratio:1.65"></a>
                    </div>
                </div>
            </nav>
        </div>
    </div>
</header>
<section class="uk-section uk-section-xsmall">
    <div class="uk-container">
        <div class="uk-grid uk-grid-small" data-uk-grid>
            <div class="uk-width-1-4@s"></div>
            <div class="uk-width-1-2@s">
                <h1 class="uk-h1 uk-text-bold uk-text-center uk-margin-remove">Installation (2/2)</h1>
                <p class="uk-text-small uk-text-center uk-margin-remove-top uk-margin-bottom">Complete this last step to finish the installation of <span class="uk-text-bold">CMS.</span>
                    <br/>Please note that the settings (expansion, emulator, and Bnet) below are configured for vMaNGOS by default.</p>
                <?= form_open('confmigrate') ?>
                <h5 class="uk-h5 uk-heading-line uk-margin-small uk-text-uppercase uk-text-bold"><span><i class="fas fa-sync fa-spin"></i> Website Settings</span></h5>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label">Server Name:</label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="website_name" placeholder="MyServer" required>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label">Realmlist:</label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="website_realmlist" placeholder="logon.domain.com" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label">Expansion:</label>
                            <div class="uk-form-controls">
                                <select class="uk-select" name="website_expansion">
                                    <option value="1">Vanilla</option>
                                    <option value="2">The Burning Crusade</option>
                                    <option value="3">Wrath of the Lich King</option>
                                    <option value="4">Cataclysm</option>
                                    <option value="5">Mist of Pandaria</option>
                                    <option value="6">Warlords of Draenor</option>
                                    <option value="7">Legion</option>
                                    <option value="8">Battle for Azeroth</option>
                                    <option value="9">ShadowLands</option>
                                </select>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label">Discord Invitation ID:</label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="website_invitation" pattern=".{,7}" placeholder="W7F4nRW" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label">Emulator:</label>
                            <div class="uk-form-controls">
                                <select class="uk-select" name="website_emulator">
                                    <option value="hex">vMaNGOS / CMaNGOS (Mangos)</option>
                                    <option value="srp6">SRP6</option>
                                    <option value="old-trinity">Battle.Net (Sha_pass_hash)</option>
                                    <option value="default">Default</option>
                                </select>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label">Bnet Enabled?:</label>
                            <div class="uk-form-controls">
                                <select class="uk-select" name="website_bnet">
                                    <option value="2">No</option>
                                    <option value="1">Yes</option>
                                </select>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-1@s">
                            <label class="uk-form-label">Redis Cache Enabled?:</label>
                            <div class="uk-form-controls">
                                <?php if (! strcasecmp(substr(PHP_OS, 0, 3), 'WIN') == 0) : ?>
                                <div class="uk-alert-warning uk-alert-small uk-margin-small" style="padding:5px !important" uk-alert>
                                    <p>If you have AUTH enabled on Redis, please set your password in <code style="color: #f0506e; background: #f8f8f8">config/redis.php -> $config['password']</code>
                                        to avoid errors.</p>
                                </div>
                                <select class="uk-select" name="website_redis">
                                    <option value="1">Yes (Recommended)</option>
                                    <option value="0">No</option>
                                    <?php else: ?>
                                    <div class="uk-alert-danger uk-alert-small uk-margin-small" style="padding:5px !important" uk-alert>
                                        <a class="uk-alert-close" style="top:11px !important" uk-close></a>
                                        <p>Redis cannot be activated on Windows.</p>
                                    </div>
                                    <select class="uk-select" name="website_redis" disabled>
                                        <option value="0">No</option>
                                        <?php endif; ?>
                                    </select>
                            </div>
                        </div>
                    </div>
                </div>
                <h5 class="uk-h5 uk-heading-line uk-margin-top uk-text-uppercase uk-text-bold"><span><i class="fas fa-dungeon"></i> Add Your First Realm</span></h5>
                <div class="uk-alert-warning uk-alert-small uk-margin-small" style="padding:5px !important" uk-alert>
                    <p>Make sure you enter the correct information. Otherwise, the site will not work properly.</p>
                </div>
                <div class="uk-margin-small uk-light">
                    <label class="uk-form-label">Realm <?= $this->lang->line('table_header_id'); ?></label>
                    <div class="uk-form-controls">
                        <input class="uk-input" type="number" name="realm_id" placeholder="Auth -> realmlist -> ID" required>
                    </div>
                </div>

                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><strong><?= $this->lang->line('placeholder_db_character'); ?></strong> <?= $this->lang->line('placeholder_db_hostname'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="character_hostname" placeholder="127.0.0.1" required>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><strong><?= $this->lang->line('placeholder_db_character'); ?></strong> <?= $this->lang->line('placeholder_db_name'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="character_database" placeholder="characters" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><strong><?= $this->lang->line('placeholder_db_character'); ?></strong> <?= $this->lang->line('placeholder_db_user'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="character_username" placeholder="root" required>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><strong><?= $this->lang->line('placeholder_db_character'); ?></strong> <?= $this->lang->line('placeholder_db_password'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="password" name="character_password" placeholder="password" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><?= $this->lang->line('placeholder_soap_hostname'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="soap_hostname" placeholder="127.0.0.1" required>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><?= $this->lang->line('placeholder_soap_port'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="number" name="soap_port" placeholder="7878" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><?= $this->lang->line('placeholder_soap_user'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="text" name="soap_username" placeholder="yesiluser" required>
                            </div>
                        </div>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><?= $this->lang->line('placeholder_soap_password'); ?></label>
                            <div class="uk-form-controls">
                                <input class="uk-input" type="password" name="soap_password" placeholder="password" required>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin-small uk-light">
                    <div class="uk-grid uk-grid-small" data-uk-grid>
                        <div class="uk-inline uk-width-1-2@s">
                            <label class="uk-form-label"><?= $this->lang->line('placeholder_emulator'); ?></label>
                            <div class="uk-form-controls">
                                <select class="uk-select" name="emulator" required>
                                    <option value="MaNGOS">vMaNGOS / CMaNGOS</option>
                                    <option value="TC">TrinityCore</option>
                                    <option value="AC">AzerothCore</option>
                                    <option value="SF">Skyfire Project</option>
                                    <option value="Oregon">OregonCore</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="uk-margin">
                    <button class="uk-button uk-button-primary uk-width-1-1 uk-margin-small-bottom" type="submit"><i class="fas fa-sync fa-spin"></i> Finish Installation</button>
                </div>
                <?= form_close(); ?>
            </div>
            <div class="uk-width-1-4@s"></div>
        </div>
    </div>
</section>
<section class="uk-section uk-section-xsmall">
    <div class="uk-container">
        <h5 class="uk-h5 uk-text-center uk-margin-remove">This installation script is based on <span class="uk-text-bold">BlizzCMS</span> and modified by
            <span class="uk-text-bold"><a href="https://discord.com/users/334013264952295435" target="_blank">Yesilmen</a></span> for vMaNGOS compabilities and new features.</h5>
    </div>
</section>
</body>
</html>
